﻿#ifndef U_MENUBAR_H
#define U_MENUBAR_H

#include "mywidget.h"

class MenuBar : public MyWidget
{
    Q_OBJECT
public:
    explicit MenuBar(QWidget *parent = nullptr);

protected:
    bool eventFilter(QObject *obj, QEvent *event);//事件过滤器
    void mouseMoveEvent(QMouseEvent *e);//鼠标移动
    void mousePressEvent(QMouseEvent *e);//鼠标按下
    void mouseReleaseEvent(QMouseEvent *);//鼠标松开
    void paintEvent(QPaintEvent *event);//绘图


signals:
    void ShowPage(int index);

public slots:
    void OnBtnMenuCloseClicked();
    void OnBtnMenuMaxClicked();
    void OnBtnMenuMinClicked();

    void OnBtnClicked();
    void OnActionClicked();
    void OnShowPage(int index);
    void UserChange();

private:

    void         InitWidget();
    void         SetupConnections();
    void         Initialize();
    QHBoxLayout* InitMenu();
    QFrame*      CreateLine();


    QList<QPushButton*> butList;
    QPushButton *butHome;
    QPushButton *butReceiver;
    QPushButton *butData;
    QPushButton *butSystem;
    QPushButton *butCos;

    QAction     *actUser;
    QAction     *actSysLog;
    QAction     *actEquipment;
    QAction     *actIp;
    QAction     *actConfig;
    QAction     *actQuality;
    QAction     *actQualityAlarm;
    QAction     *actSimHis;
    QAction     *actCos;

    QAction     *actLogin;
    QAction     *actPwd;
    QAction     *actLogout;
    QAction     *actAbout;
    QAction     *actThemeBlue;
    QAction     *actThemeBlack;

    QWidget *parent;
    QWidget* widget;
    QLabel  *labLogo;
    bool    max;
    bool    mousePressed;
    QPoint  mousePoint;

    QToolButton *butUser;
    QToolButton *butMenuMin;
    QToolButton *butMenuMax;
    QToolButton *butMenuClose;

};

#endif // U_MENUBAR_H
